///////////////////////////////////////////
// Authors : Mathieu Robitaille - 6396682
//           Sacha Sukhdeo - 6054412
// Class : COMP445
//         Assignment 2
///////////////////////////////////////////
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <lmcons.h> // see GetUserName(char*, int) on MSDN
//#define REQUEST_PORT 5001

#define HOSTNAME_LENGTH 20
#define FILENAME_LENGTH 20
#define RESP_LENGTH 40

typedef enum{
    // New requests types
	REQ_GET=0,
    REQ_PUT,
    REQ_LIST,
    REQ_DEL,

    REQ_FILE,
	MSG_ERR,

    ACK,
    NACK,
    HANDSHAKE,
    RESP //Message type
} Type;


typedef enum{
    // used to differentiate between the three stages of a 3-way handshake.
	FIRST_STEP_SHAKE,
	SECOND_STEP_SHAKE,
	THIRD_STEP_SHAKE
} HandShakeSTEP;

#define BUFFER_LENGTH 1024
typedef struct
{
    Type type;
    int length; //length of effective bytes in the buffer
    int  seqNb;
    int  ack;
    char buffer[BUFFER_LENGTH];
} Msg; //message format used for sending and receiving
#define MSGHDRSIZE sizeof(Msg) - sizeof(char)*BUFFER_LENGTH //Message Header Size

typedef struct
{
	HandShakeSTEP handShakeSTEP;
	int Ack;
	int ReturnAck;
}HandShakeMsg;

typedef struct
{
	char hostname[HOSTNAME_LENGTH];
	char filename[FILENAME_LENGTH];
	char username[UNLEN+1];
} Req;  //request

#define FILEDATA_BUFFER_LENGTH (BUFFER_LENGTH-3*sizeof(int))
typedef struct {
    //int idx;
    //int count;
    int length;
    char filedata[FILEDATA_BUFFER_LENGTH];
} FileData;

typedef struct  
{
	char response[RESP_LENGTH];
} Resp; //response

